package cn.com.zero.common.message.controller;

import cn.com.zero.common.message.service.IMessageService;
import cn.hutool.core.util.StrUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xiongxj
 * @version 1.0.0
 * @Description 消息controller类
 * @createTime 2023/3/1 14:03
 */
@RestController
@RequestMapping("/message")
public class MessageController {

    private IMessageService messageService;

    @GetMapping("/test/list")
    public String messageList(@RequestParam(value = "phone", required = false) String phone) {
        if (StrUtil.isEmpty(phone)) {
            return null;
        }
        return messageService.queryMessage(phone);
    }

    @Autowired
    public void setMessageService(IMessageService messageService) {
        this.messageService = messageService;
    }
}
